#!/usr/bin/env python3
"""
find-node.py  model.onnx
只打印 GS 可识别的合法张量名（带 dtype+shape）
"""
import onnx
import onnx_graphsurgeon as gs

def main():
    import sys
    if len(sys.argv) != 2:
        print("用法: python find-node.py model.onnx")
        sys.exit(1)

    model = onnx.load(sys.argv[1])
    graph = gs.import_onnx(model)

    for name in sorted(graph.tensors()):
        tensor = graph.tensors()[name]
        # 必须同时有 dtype 和 shape
        if tensor.dtype is not None and tensor.shape is not None:
            print(name)

if __name__ == "__main__":
    main()